'''
排序查询
    SELECT 查询列表
    FROM 表
    [WHERE 筛选条件]
    [order by 排序列表(asc/desc)] 可以支持单个字段,多个字段,表达式,函数,别名
'''
import pymysql
conn = pymysql.connect(
    host='localhost',
    user='root',
    passwd='123456',
    db='db_library',
    port=3306,
    charset='utf8'
)
cur = conn.cursor()

# 案例:   查询员工的信息,要求年龄从高到低
w = "SELECT * FROM test ORDER BY age DESC"
cur.execute(w)
ret = cur.fetchall()
print(ret)
conn.commit()









